<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../Vue全家桶_stu/03_依赖包/vue.js"></script>
</head>
<body>
    <div id="root">
        <!-- ref用来获取DOM节点 -->
        <p><input type="text" placeholder="请输入账号" ref="username"></p>
        <p><input type="text" placeholder="请输入密码" ref="password"></p>
        <p><button @click="login">登录</button></p>
    </div>
    <script>
        const vm = new Vue({
            el:'#root',
            methods:{
                login(){
                    // 获取DOM节点
                    console.log(this.$refs)
                    let username = this.$refs.username.value
                    let password = this.$refs.password.value
                    alert(`用户名:${username}密码:${password}`)
                }
            }
        })
    </script>
</body>
</html>